<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>@yield('title')</title>

    <!-- Styles -->
    <link rel="stylesheet" href="{{ asset('css/app.css') }}">
    <!-- Custom style -->
    <link rel="stylesheet" href="{{asset('css/watermelon.css')}}">
</head>
<body>
    <div id="app">
        <nav class="navbar navbar-default navbar-static-top">
            <div class="container">
                <div class="navbar-header">

                    <!-- Collapsed Hamburger -->
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse">
                        <span class="sr-only">Toggle Navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>

                    <!-- Branding Image -->
                    <a class="navbar-brand" href="{{ url('/') }}">
                        {{ config('app.name', 'watermelon') }}
                    </a>
                </div>

                <div class="collapse navbar-collapse" id="app-navbar-collapse">
                    <!-- Left Side Of Navbar -->
                    <ul class="nav navbar-nav">
                        &nbsp;
                    </ul>

                    <!-- Right Side Of Navbar -->
                    <ul class="nav navbar-nav navbar-right">
                        <!-- Authentication Links -->
                        @guest
                            <li><a href="{{ route('login') }}">登录</a></li>
                            <li><a href="{{ route('register') }}">注册</a></li>
                        @else
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
                                    {{ Auth::user()->name }} <span class="caret"></span>
                                </a>

                                <ul class="dropdown-menu" role="menu">
                                    <li>
                                        <a href="{{ route('logout') }}"
                                            onclick="event.preventDefault();
                                                     document.getElementById('logout-form').submit();">
                                            退出
                                        </a>

                                        <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                            {{ csrf_field() }}
                                        </form>
                                    </li>
                                </ul>
                            </li>
                        @endguest
                    </ul>
                </div>
            </div>
        </nav>

        @yield('content')

    </div>

    <!-- Scripts -->
    <script src="{{ asset('js/app.js') }}"></script>
    <script>
        document.addEventListener('touchmove', function (e) {
            e.preventDefault();
        });
        var c = document.getElementsByTagName('canvas')[0];
        var x = c.getContext('2d');
        var pr = window.devicePixelRatio || 1;
        var w = window.innerWidth;
        var h = window.innerHeight;
        var f = 90;
        var q;
        var m = Math;
        var r = 0;
        var u = m.PI * 2;
        var v = m.cos;
        var z = m.random;
        c.width = w * pr;
        c.height = h * pr;
        x.scale(pr, pr);
        x.globalAlpha = 0.6;
        function y (p) {
            var t = p + (z() * 2 - 1.1) * f;
            return (t > h || t < 0) ? y(p) : t;
        }
        function d (i, j) {
            x.beginPath();
            x.moveTo(i.x, i.y);
            x.lineTo(j.x, j.y);
            var k = j.x + (z() * 2 - 0.25) * f;
            var n = y(j.y);
            x.lineTo(k, n);
            x.closePath();
            r -= u / -50;
            x.fillStyle = '#' + (v(r) * 127 + 128 << 16 | v(r + u / 3) * 127 + 128 << 8 | v(r + u / 3 * 2) * 127 + 128).toString(16);
            x.fill();
            q[0] = q[1];
            q[1] = {x: k, y: n};
        }
        function i () {
            x.clearRect(0, 0, w, h);
            q = [{x: 0, y: h * 0.7 + f }, {x: 0, y: h * 0.7 - f}];
            while (q[1].x < w + f) {
                d(q[0], q[1]);
            }
        }
        document.onclick = i;
        document.ontouchstart = i;
        i();
    </script>
</body>
</html>
